def is_valid_bracket_sequence(sequence):
    stack = []
    bracket_pairs = {'(': ')', '[': ']', '{': '}', '<': '>'}
    for bracket in sequence:
        if bracket in bracket_pairs:
            stack.append(bracket)
        elif bracket in bracket_pairs.values():
            if not stack or bracket_pairs[stack.pop()] != bracket:
                return False
    return not stack

sequence = input("Введите скобочную последовательность: ")
if is_valid_bracket_sequence(sequence):
    print("True")
else:
    print("False")
